<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-on:(@)</title>
    <script src="node_modules/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
    <h1>num={{num}}</h1>
    <button v-on:click="num++">增加</button><br>
    <button @click="decrement">减少</button><br>
    <hr>
    <!--演示事件冒泡-->
    事件冒泡测试:<br>
    <div style="background-color: aquamarine;width: 100px;height: 40px" @click="print('div点击')">
        <button @click.stop="print('点击了button')">点击我</button>
    </div>

</div>
<script type="text/javascript">
    var app=new Vue({
        el:"#app",
        data:{
            num:1
        },
        methods:{
            //递减
            decrement(){
                this.num--;
            },
            //事件冒泡
            print(str){
                console.log(str);
            }
        }
    });
</script>
</body>
</html>